import request from '@/utils/request'

// 获取数据源列表
export function getDataSources() {
    return request({
        url: '/analysis/sources/',
        method: 'get'
    })
}

// 创建数据源
export function createDataSource(data) {
    return request({
        url: '/analysis/sources/',
        method: 'post',
        data
    })
}

// 更新数据源
export function updateDataSource(id, data) {
    return request({
        url: `/analysis/sources/${id}/`,
        method: 'put',
        data
    })
}

// 删除数据源
export function deleteDataSource(id) {
    return request({
        url: `/analysis/sources/${id}/`,
        method: 'delete'
    })
}

// 测试数据源连接
export function testDataSourceConnection(id) {
    return request({
        url: `/analysis/sources/${id}/test_connection/`,
        method: 'post'
    })
} 